<?php

$db = new PDO('mysql:host=localhost; dbname=db3', 'root', '12qwas');
$ps = $db->prepare('select * from students limit 1,2');
$ps->bindColumn(1, $xh);//通过列号绑定，从 1 开始
$ps->bindColumn(2, $name);
$ps->bindColumn('age', $age, PDO::PARAM_INT);//通过列名绑定
$ps->execute();
foreach ($ps as $r) {
    echo "{$xh}\t{$name}\t{$age}\n";//可直接使用绑定到列的变量名
}